#!/usr/bin/perl
# Ikiwiki setup automator (modificado)
# Instrucoes: ikiwiki -setup wiki.setup

require IkiWiki::Setup::Automator;

our $wikiname=IkiWiki::Setup::Automator::ask(
  gettext("Qual sera o nome desta wiki?"), gettext("wiki"));
our $wikiname_short=IkiWiki::Setup::Automator::sanitize_wikiname($wikiname);
our $rcs="git";
use Net::Domain q{hostfqdn};
our $domain=hostfqdn() || IkiWiki::Setup::Automator::ask(
  gettext("What is the domain name of the web server?"), "localhost");
our $admin=IkiWiki::Setup::Automator::ask(
  gettext("Which user (wiki account or openid) will be admin?"), $ENV{USER});
our $adminemail=IkiWiki::Setup::Automator::ask(
  gettext("E-mail da(o) administrador(a)?"), "$ENV{USER}\@$domain");
our $srcdir=IkiWiki::Setup::Automator::ask(
  gettext("Aonde o codigo fonte da wiki foi clonado?"), "$ENV{HOME}/$wikiname_short");
our $repository=IkiWiki::Setup::Automator::ask(
  gettext("Aonde sera o repositorio da wiki? (omitir .git)"), "$ENV{HOME}/$wikiname_short");
our $destdir=IkiWiki::Setup::Automator::ask(
  gettext("Aonde sera compilado o html? (diretorio do servidor web)"), "$ENV{HOME}/public_html/$wikiname_short");
our $url=IkiWiki::Setup::Automator::ask(
  gettext("Qual sera o URL da wiki?"), "http://$domain/~$ENV{USER}/$wikiname_short");

IkiWiki::Setup::Automator->import(
  wikiname => "$wikiname",
  adminuser => ["$admin"],
  rcs => "$rcs",
  srcdir => "$srcdir",
  destdir => "$destdir",
  repository => "$repository.".($rcs eq "monotone" ? "mtn" : $rcs),
  dumpsetup => "$srcdir/.ikiwiki/$wikiname_short.setup",
  url => "$url",
  cgiurl => "$url/ikiwiki.cgi",
  cgi_wrapper => "$destdir/ikiwiki.cgi",
  adminemail => $adminemail,
  add_plugins => [qw{goodstuff websetup gitpush attachment calendar comments html listdirectives relativedate remove rename search sidebar theme trail txt userlist 404}],
  disable_plugins => [qw{}],
  libdir => "$ENV{HOME}/.ikiwiki",
  rss => 1,
  atom => 1,
  syslog => 1,
  reverse_proxy => 1,
  only_committed_changes => 1,
  verbose => 1,
  usedirs => 1,
  prefix_directives => 1,
  indexpages => 1,
  discussion => 1,
  discussionpage => 'discussao',
  html5 => 1,
  sslcookie => 0,
  default_pageext => 'mdwn',
  htmlext => 'html',
  timeformat => '%c',
  locale => 'pt_BR.UTF-8',
  userdir => 'users',
  numbacklinks => 0,
  responsive_layout => 1,
  branchable => 1,
  anonpush => 1,
  branchable_action => 1,
  allowrss => 0,
  multimarkdown => 1,
  comments_pagespec => '*',
  comments_closed_pagespec => '',
  comments_pagename => 'comment_',
  comments_commit => 1,
  comments_allowformats => 'mdwn, html',
  repositories => [],
  theme => 'actiontabs',
  archivebase => 'archives',
  archive_pagespec => '*',
  calendar_autocreate => '',
  calendar_fill_gaps => 1,
  directive_description_dir => 'ikiwiki/directive',
  aggregateinternal => 1,
  autoindex_commit => 1,
  prettydateformat => '%X, %B %o, %Y',
  recentchangespage => 'recentchanges',
  recentchangesnum => 100,
  global_sidebars => 1,
  tagbase => 'tag',
  tag_autocreate => 1,
  tag_autocreate_commit => 1,
  filetypes_conf => /etc/highlight/filetypes.conf,
  langdefdir => /usr/share/highlight/langDefs,
  websetup_unsafe => [],
  websetup_show_unsafe => 1,
);

